#pragma once
#include <atlcrack.h>


class CSlideTreeView :	public CWindowImpl<CSlideTreeView, CWindow>,
						public CChildView<CSlideTreeView>
{
private:
	CTreeViewCtrl	m_wndTree;
	CImageList		m_imlTree;

public:
//	DECLARE_WND_SUPERCLASS(NULL, CTreeViewCtrl::GetWndClassName())

	CSlideTreeView()
	{
#if _WIN32_WCE > 0x420
		m_imlTree.Create(16, 16, ILC_COLOR32, 4, 8);
#else
		m_imlTree.Create(16, 16, ILC_COLOR, 4, 8);
#endif
	} 

	BEGIN_MSG_MAP(CSlideTreeView)
		MSG_WM_CREATE(OnCreate)
		MSG_WM_SIZE(OnSize)
		MSG_WM_SETFOCUS(OnSetFocus)
	END_MSG_MAP()

// Handler prototypes (uncomment arguments if needed):
//	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
//	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
//	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

	LRESULT OnCreate(LPCREATESTRUCT lpCreateStruct)
	{
		DWORD	dwStyle	= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS;
		HWND	hWnd;

		hWnd = m_wndTree.Create(m_hWnd, 0, 0, dwStyle);
		if(m_hWnd)
		{
			m_wndTree.InsertItem(_T("Form"), TVI_ROOT, TVI_LAST);
			m_wndTree.InsertItem(_T("List"), TVI_ROOT, TVI_LAST);
			m_wndTree.InsertItem(_T("Tree"), TVI_ROOT, TVI_LAST);
		}
		return 0;
	}

	LRESULT OnSize(UINT state, CSize size)
	{
		m_wndTree.MoveWindow(0, 0, size.cx, size.cy);
		return 0;
	}

	LRESULT OnSetFocus(HWND hwndOldFocus)
	{
		m_wndTree.SetFocus();
		return 0;
	}
};
